<template>
  <div>
    <el-card>
      <h2 style="text-align: center">开放实验室使用申请</h2>
      <el-form label-width="70px" style="margin-bottom: 30px">
        <el-form-item label="使用原因" prop="reason_use">
          <el-input
            v-model="KaiFangForm.reason_use"
            type="textarea"
            disabled
          ></el-input>
        </el-form-item>
        <el-form-item label="项目名称" prop="porject_name">
          <el-input v-model="KaiFangForm.porject_name" disabled></el-input>
        </el-form-item>
        <!-- <el-form-item label="使用时间" prop="UseTime">
            <el-input v-model="KaiFangForm.UseTime" disabled></el-input>
          </el-form-item> -->
        <el-form-item
          label="开始使用时间"
          prop="start_time"
          style="width: 40%; display: inline-block; margin-left: 0%"
          label-width="100px"
        >
          <el-input
            v-model="KaiFangForm.start_time"
            disabled
            style="margin-left: 0px"
          ></el-input>
        </el-form-item>
        <el-form-item
          label="结束使用时间"
          prop="end_time"
          style="width: 40%; display: inline-block; margin-left: 20%"
          label-width="100px"
        >
          <el-input
            v-model="KaiFangForm.end_time"
            disabled
            style="margin-left: 0px"
          ></el-input>
        </el-form-item>
        <h3>申请学生名单</h3>
        <el-table :data="ApplyList" border stripe height="140">
          <el-table-column label="姓名" prop="student_name"> </el-table-column>
          <el-table-column label="学号" prop="student_id"> </el-table-column>
          <el-table-column label="联系电话" prop="phone"></el-table-column>
          <el-table-column label="承担工作" prop="work"> </el-table-column>
        </el-table>
      </el-form>
      <el-form>
        <el-form-item label="审批结果:" style="margin-top: 20px">
          <div style="font-size: 22px; text-align: left; margin-left: 15px">
            {{ this.tableDataReason }}
          </div>
        </el-form-item>
      </el-form>
      <span style="text-indent: 2em">
        疫情特殊时期,我承诺学生进入实验室后第一时间给学生宣讲《实验室疫情个人防护常识》
        ,并拍照存档。在实验室期间要求同尝们隔位而坐。配合实验中心相关工作安排。
      </span>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      // 开放实验室使用申请
      KaiFangForm: {},
      //开放实验室使用申请 申请学生名单
      ApplyList: [],
      tableDataReason: {},
    };
  },
  created() {
    this.getList();
  },
  methods: {
    async getList() {
      const { data: res } = await this.$http.post(
        "/api/student/openlabselect",
        {
          form_id: sessionStorage.getItem("KaiFang"),
        }
      );
      // console.log(res);
      if (res.code !== 200) {
        return this.$message.error("获取开放实验室使用申请单信息失败！");
      }
      this.$message.success("成功获取开放实验室使用申请单信息！");
      this.KaiFangForm = res.data[0];
      const { data: re } = await this.$http.post(
        "/api/student/openlabselectstu",
        {
          form_id: sessionStorage.getItem("KaiFang"),
        }
      );
      // console.log(re);
      if (res.code !== 200) {
        return this.$message.error("获取开放实验室使用申请单在学生信息失败！");
      }
      this.$message.success("成功获取开放实验室使用申请单在学生信息！");
      // console.log(re.data);
      this.ApplyList = re.data;
      this.tableDataReason = sessionStorage.getItem("reason");
    },
  },
};
</script>
<style scoped>
.el-card {
  width: 60%;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
</style>